/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package GameController;

import Car.Car;
import GameView.RCCanvas;
import Point.Point;
import java.util.ArrayList;
import javax.swing.JFrame;
import javax.swing.SwingUtilities;

/**
 *
 * @author Mirza
 */

public class RCController {
    
    private static ArrayList<Car> ExistedCars;
    private static int rentang = 10;
    private int MaxCar = 128;
    
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        
        ExistedCars = new ArrayList<>(10);
        
        Point StartPos = new Point(0,0);//line , posy
        Car tempcar = new Car(StartPos,6);
        ExistedCars.add(0,tempcar);
        
        //System.out.println("DEBUGadding Car#2");
        StartPos = new Point(1,4);
        tempcar = new Car(StartPos,5);
        ExistedCars.add(1,tempcar);

        //System.out.println("DEBUGadding Car#3");
        StartPos = new Point(2,8);
        tempcar = new Car(StartPos,2);
        ExistedCars.add(2,tempcar);
        
        //System.out.println("DEBUGadding Car#4");
        StartPos = new Point(3,4);
        tempcar = new Car(StartPos,3);
        ExistedCars.add(3,tempcar);

        //System.out.println("DEBUGadding Car#5");
        StartPos = new Point(4,4);
        tempcar = new Car(StartPos,10);
        ExistedCars.add(4,tempcar);
        
        //System.out.println("DEBUGadding Car#6");
        StartPos = new Point(5,2);
        tempcar = new Car(StartPos,7);
        ExistedCars.add(5,tempcar);
        
        //System.out.println("DEBUGadding Car#7");
        StartPos = new Point(6,3);
        tempcar = new Car(StartPos,8);
        ExistedCars.add(6,tempcar);
        
        //System.out.println("DEBUGadding Car#8");
        StartPos = new Point(7,-12);
        tempcar = new Car(StartPos,20);
        ExistedCars.add(7,tempcar);
        
        //System.out.println("DEBUGadding Car#9");
        StartPos = new Point(8,-32);
        tempcar = new Car(StartPos,30);
        ExistedCars.add(8,tempcar);
        
        //System.out.println("DEBUGSize: "+ExistedCars.size());
        
        //System.out.println("DEBUGadding Car#1");
        
        SwingUtilities.invokeLater(new Runnable() {
            @Override
            public void run() {
                createAndShowGUI(); 
            }
        });
    }
    
    /**
     * Procedure to create windows with swing
     */
    public static void createAndShowGUI(){
        JFrame f = new JFrame("Mobil Gerak V3");
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 
        f.add(new RCCanvas(ExistedCars));
        f.pack();
        f.setVisible(true);
    }
}
